
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>4.1 着色器是什么 · 游戏引擎浅入浅出</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="captainchen">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="4.2 Unity Shader和OpenGL Shader.html" />
    
    
    <link rel="prev" href="4. 着色器.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">目录</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../前言.html">
            
                <a href="../前言.html">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../1. 游戏引擎框架介绍/1. 游戏引擎框架介绍.html">
            
                <a href="../1. 游戏引擎框架介绍/1. 游戏引擎框架介绍.html">
            
                    
                    1. 游戏引擎框架介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../1. 游戏引擎框架介绍/1.1 暗中观察unity.html">
            
                <a href="../1. 游戏引擎框架介绍/1.1 暗中观察unity.html">
            
                    
                    1.1 暗中观察unity
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="../1. 游戏引擎框架介绍/1.2 游戏引擎组成.html">
            
                <a href="../1. 游戏引擎框架介绍/1.2 游戏引擎组成.html">
            
                    
                    1.2 游戏引擎组成
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="../2. Opengl开发环境搭建/2. Opengl开发环境搭建.html">
            
                <a href="../2. Opengl开发环境搭建/2. Opengl开发环境搭建.html">
            
                    
                    2. Opengl开发环境搭建
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="../2. Opengl开发环境搭建/2.1 Opengl到底是什么.html">
            
                <a href="../2. Opengl开发环境搭建/2.1 Opengl到底是什么.html">
            
                    
                    2.1 Opengl到底是什么
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="../2. Opengl开发环境搭建/2.2 搭建Opengl开发环境.html">
            
                <a href="../2. Opengl开发环境搭建/2.2 搭建Opengl开发环境.html">
            
                    
                    2.2 搭建Opengl开发环境
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="../3. 绘制简单图形/3. 绘制简单图形.html">
            
                <a href="../3. 绘制简单图形/3. 绘制简单图形.html">
            
                    
                    3. 绘制简单图形
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../3. 绘制简单图形/3.1 画个三角形.html">
            
                <a href="../3. 绘制简单图形/3.1 画个三角形.html">
            
                    
                    3.1 画个三角形
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="../3. 绘制简单图形/3.2 画个正方形.html">
            
                <a href="../3. 绘制简单图形/3.2 画个正方形.html">
            
                    
                    3.2 画个正方形
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.3" data-path="../3. 绘制简单图形/3.3 画个立方体.html">
            
                <a href="../3. 绘制简单图形/3.3 画个立方体.html">
            
                    
                    3.3 画个立方体
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="4. 着色器.html">
            
                <a href="4. 着色器.html">
            
                    
                    4. 着色器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="2.5.1" data-path="4.1 着色器是什么.html">
            
                <a href="4.1 着色器是什么.html">
            
                    
                    4.1 着色器是什么
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.2" data-path="4.2 Unity Shader和OpenGL Shader.html">
            
                <a href="4.2 Unity Shader和OpenGL Shader.html">
            
                    
                    4.2 Unity Shader和OpenGL Shader
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.3" data-path="4.3 顶点着色器.html">
            
                <a href="4.3 顶点着色器.html">
            
                    
                    4.3 顶点着色器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.4" data-path="4.4 片段着色器.html">
            
                <a href="4.4 片段着色器.html">
            
                    
                    4.4 片段着色器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="../5. 绘制贴图/5. 绘制贴图.html">
            
                <a href="../5. 绘制贴图/5. 绘制贴图.html">
            
                    
                    5. 绘制贴图
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="../5. 绘制贴图/5.1 颜色和贴图.html">
            
                <a href="../5. 绘制贴图/5.1 颜色和贴图.html">
            
                    
                    5.1 颜色和贴图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.2" data-path="../5. 绘制贴图/5.2 贴图文件介绍.html">
            
                <a href="../5. 绘制贴图/5.2 贴图文件介绍.html">
            
                    
                    5.2 贴图文件介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.3" data-path="../5. 绘制贴图/5.3 CPU与GPU的通信方式.html">
            
                <a href="../5. 绘制贴图/5.3 CPU与GPU的通信方式.html">
            
                    
                    5.3 CPU与GPU的通信方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.4" data-path="../5. 绘制贴图/5.4 使用stb_image解析图片.html">
            
                <a href="../5. 绘制贴图/5.4 使用stb_image解析图片.html">
            
                    
                    5.4 使用stb_image解析图片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.5" data-path="../5. 绘制贴图/5.5 绘制带贴图的立方体盒子.html">
            
                <a href="../5. 绘制贴图/5.5 绘制带贴图的立方体盒子.html">
            
                    
                    5.5 绘制带贴图的立方体盒子
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.6" data-path="../5. 绘制贴图/5.6 压缩纹理.html">
            
                <a href="../5. 绘制贴图/5.6 压缩纹理.html">
            
                    
                    5.6 压缩纹理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.7" data-path="../5. 绘制贴图/5.7 图片压缩工具.html">
            
                <a href="../5. 绘制贴图/5.7 图片压缩工具.html">
            
                    
                    5.7 图片压缩工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.8" data-path="../5. 绘制贴图/5.8 使用压缩纹理.html">
            
                <a href="../5. 绘制贴图/5.8 使用压缩纹理.html">
            
                    
                    5.8 使用压缩纹理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="../6. 索引与缓冲区对象/6. 缓冲区对象.html">
            
                <a href="../6. 索引与缓冲区对象/6. 缓冲区对象.html">
            
                    
                    6. 缓冲区对象
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.7.1" data-path="../6. 索引与缓冲区对象/6.1 顶点索引.html">
            
                <a href="../6. 索引与缓冲区对象/6.1 顶点索引.html">
            
                    
                    6.1 顶点索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.2" data-path="../6. 索引与缓冲区对象/6.2 缓冲区对象.html">
            
                <a href="../6. 索引与缓冲区对象/6.2 缓冲区对象.html">
            
                    
                    6.2 缓冲区对象
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="../7. Mesh和材质/7. Mesh和材质.html">
            
                <a href="../7. Mesh和材质/7. Mesh和材质.html">
            
                    
                    7. Mesh和材质
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.8.1" data-path="../7. Mesh和材质/7.1 导出Mesh文件.html">
            
                <a href="../7. Mesh和材质/7.1 导出Mesh文件.html">
            
                    
                    7.1 导出Mesh文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.2" data-path="../7. Mesh和材质/7.2 使用Mesh文件.html">
            
                <a href="../7. Mesh和材质/7.2 使用Mesh文件.html">
            
                    
                    7.2 使用Mesh文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.3" data-path="../7. Mesh和材质/7.3 Shader文件创建与使用.html">
            
                <a href="../7. Mesh和材质/7.3 Shader文件创建与使用.html">
            
                    
                    7.3 Shader文件创建与使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >4.1 着色器是什么</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <html><head></head><body><div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><ul><li><span class="title-icon "></span><a href="#41-&#x7740;&#x8272;&#x5668;&#x662F;&#x4EC0;&#x4E48;"><b></b>4.1 &#x7740;&#x8272;&#x5668;&#x662F;&#x4EC0;&#x4E48;</a></li><ul><li><span class="title-icon "></span><a href="#&#x7740;&#x8272;&#x5668;&#x7684;&#x79CD;&#x7C7B;"><b></b>&#x7740;&#x8272;&#x5668;&#x7684;&#x79CD;&#x7C7B;</a></li></ul></ul></ul></div><h2 id="41-&#x7740;&#x8272;&#x5668;&#x662F;&#x4EC0;&#x4E48;"><a name="41-&#x7740;&#x8272;&#x5668;&#x662F;&#x4EC0;&#x4E48;" class="anchor-navigation-ex-anchor" href="#41-&#x7740;&#x8272;&#x5668;&#x662F;&#x4EC0;&#x4E48;"><i class="fa fa-link" aria-hidden="true"></i></a>4.1 &#x7740;&#x8272;&#x5668;&#x662F;&#x4EC0;&#x4E48;</h2>
<p>&#x7740;&#x8272;&#x5668;&#x5C31;&#x662F;Shader&#xFF0C;Shader&#x5C31;&#x662F;&#x4E00;&#x6BB5;GPU&#x7A0B;&#x5E8F;&#x6E90;&#x7801;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x5927;&#x5B66;&#x5C31;&#x5B66;&#x8FC7;&#x7684;C&#x8BED;&#x8A00;&#x662F;CPU&#x7A0B;&#x5E8F;&#x6E90;&#x7801;&#xFF0C;Shader&#x548C;C &#x8BED;&#x8A00;&#x6709;&#x5F88;&#x591A;&#x76F8;&#x4F3C;&#x4E4B;&#x5904;&#xFF0C;&#x4E5F;&#x8981;&#x5199;&#x4EE3;&#x7801;&#x3001;&#x7F16;&#x8BD1;&#x3001;&#x94FE;&#x63A5;&#x3002;</p>
<p>&#x901A;&#x8FC7;&#x4E0B;&#x9762;&#x7684;&#x8868;&#x683C;&#x6765;&#x505A;&#x5BF9;&#x7167;&#x3002;</p>
<table>
<tbody><tr><td></td><td bgcolor="AliceBlue"><b>C&#x8BED;&#x8A00;</b></td><td bgcolor="AliceBlue"><b>Shader</b></td></tr>
<tr><td><b>&#x76EE;&#x6807;&#x786C;&#x4EF6;</b></td><td>CPU</td><td>GPU</td></tr>
<tr><td rowspan="6"><b>&#x7F16;&#x8BD1;&#x6D41;&#x7A0B;</b></td><td>&#x521B;&#x5EFA;&#x9879;&#x76EE;</td><td>&#x521B;&#x5EFA;GPU&#x7A0B;&#x5E8F;</td></tr>
<tr><td>&#x521B;&#x5EFA;&#x591A;&#x4E2A;&#x4EE3;&#x7801;&#x6587;&#x4EF6;</td><td>&#x521B;&#x5EFA;Shader&#x5BF9;&#x8C61;(&#x9876;&#x70B9;Shader&#x548C;&#x7247;&#x6BB5;Shader) </td></tr>
<tr><td>&#x7F16;&#x5199;&#x591A;&#x4E2A;&#x4EE3;&#x7801;</td><td>&#x4E0A;&#x4F20;Shader&#x6E90;&#x7801;&#x5230;Shader&#x5BF9;&#x8C61;</td></tr>
<tr><td>&#x7F16;&#x8BD1;&#x4EE3;&#x7801;</td><td>&#x7F16;&#x8BD1;Shader</td></tr>
<tr><td>&#x6DFB;&#x52A0;&#x5230;&#x94FE;&#x63A5;&#x5217;&#x8868;</td><td>&#x6DFB;&#x52A0;&#x5230;&#x94FE;&#x63A5;&#x5217;&#x8868;</td></tr>
<tr><td>&#x94FE;&#x63A5;</td><td>&#x94FE;&#x63A5;</td></tr>
</tbody></table>

<p>&#x662F;&#x4E0D;&#x662F;&#x5F88;&#x76F8;&#x4F3C;&#x5462;&#xFF01;</p>
<p>&#x6E32;&#x67D3;&#x4E00;&#x4E2A;&#x56FE;&#x50CF;&#xFF0C;&#x5176;&#x5B9E;&#x5C31;&#x662F;&#x5728;GPU&#x4E0A;&#x6267;&#x884C;&#x4E86;Shader&#x4EE3;&#x7801;&#xFF0C;&#x7136;&#x540E;&#x5C06;&#x9876;&#x70B9;&#x5750;&#x6807;&#x3001;&#x989C;&#x8272;&#x6570;&#x636E;&#x4F5C;&#x4E3A;&#x8F93;&#x5165;&#xFF0C;&#x7ECF;&#x7531;Shader&#x8FDB;&#x884C;&#x5904;&#x7406;&#xFF0C;&#x7136;&#x540E;&#x8F93;&#x51FA;&#x50CF;&#x7D20;&#x6570;&#x636E;&#x5230;&#x5C4F;&#x5E55;&#x4E0A;&#x3002;</p>
<p>&#x548C;C&#x8BED;&#x8A00;&#x4E0D;&#x4E00;&#x6837;&#x7684;&#x662F;&#xFF0C;C&#x8BED;&#x8A00;&#x53EA;&#x9700;&#x8981;&#x4E00;&#x4E2A;main.c &#x6587;&#x4EF6;&#x5C31;&#x53EF;&#x4EE5;&#x7F16;&#x8BD1;&#x6210;&#x529F;&#x3002;
&#x4F46;&#x662F;Shader&#x662F;&#x914D;&#x5957;&#x51FA;&#x73B0;&#x7684;&#xFF0C; Vertex Shader(&#x9876;&#x70B9;&#x7740;&#x8272;&#x5668;)&#x3001;Fragment Shader(&#x7247;&#x6BB5;&#x7740;&#x8272;&#x5668;)&#xFF0C;&#x4E24;&#x8005;&#x7F3A;&#x4E00;&#x4E0D;&#x53EF;&#x3002;</p>
<table>
<tbody><tr><td></td><td bgcolor="AliceBlue"><b>C&#x8BED;&#x8A00;</b></td><td bgcolor="AliceBlue"><b>Shader</b></td></tr>
<tr><td><b>&#x76EE;&#x6807;&#x786C;&#x4EF6;</b></td><td>CPU</td><td>GPU</td></tr>
<tr><td rowspan="6"><b>&#x4EE3;&#x7801;&#x6587;&#x4EF6;&#x5217;&#x8868;</b></td><td>main.c</td><td>main.vs(Vertex Shader)</td></tr>
<tr><td>...</td><td>main.fs(Fragment Shader)</td></tr>
</tbody></table>

<h3 id="&#x7740;&#x8272;&#x5668;&#x7684;&#x79CD;&#x7C7B;"><a name="&#x7740;&#x8272;&#x5668;&#x7684;&#x79CD;&#x7C7B;" class="anchor-navigation-ex-anchor" href="#&#x7740;&#x8272;&#x5668;&#x7684;&#x79CD;&#x7C7B;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7740;&#x8272;&#x5668;&#x7684;&#x79CD;&#x7C7B;</h3>
<p>Vertex Shader(&#x9876;&#x70B9;&#x7740;&#x8272;&#x5668;)&#x3001;Fragment Shader(&#x7247;&#x6BB5;&#x7740;&#x8272;&#x5668;) &#x6211;&#x4EEC;&#x542C;&#x5230;&#x6700;&#x591A;&#x7684;&#x5C31;&#x662F;&#x8FD9;&#x4E24;&#x4E2A;&#x3002;
Geometry Shader&#x3001;Computer Shader&#x770B;&#x8FC7;&#x4F46;&#x662F;&#x5B9E;&#x9645;&#x9879;&#x76EE;&#x4E2D;&#x6CA1;&#x7528;&#x8FC7;&#x3002;
Tessellation Control Shader &#x3001;Tessellation Evaluation Shader&#x8FD9;&#x4E24;&#x4E2A;&#x5C31;&#x51E0;&#x4E4E;&#x6CA1;&#x6709;&#x542C;&#x8FC7;&#x3002;</p>
<p>&#x8FD9;&#x662F;&#x7531;&#x5DE5;&#x4F5C;&#x5185;&#x5BB9;&#x51B3;&#x5B9A;&#x7684;&#xFF0C;&#x5927;&#x5BB6;&#x90FD;&#x662F;&#x4ECE;&#x4E8B;&#x624B;&#x673A;&#x6E38;&#x620F;&#x5F00;&#x53D1;&#x3002;
&#x76EE;&#x524D;&#x5E02;&#x9762;&#x4E0A;&#x7684;&#x624B;&#x673A;&#xFF0C;&#x5F88;&#x5927;&#x4E00;&#x90E8;&#x5206;&#x4ECD;&#x7136;&#x662F;OpenGL ES3.0&#x7684;&#x7248;&#x672C;&#x6216;&#x66F4;&#x4F4E;&#x3002;</p>
<p>Computer Shader&#x5728;OpenGL ES 3.1&#x7248;&#x672C;&#x624D;&#x5F00;&#x59CB;&#x652F;&#x6301;&#x3002;
Geometry Shader&#x5728;OpenGL ES 3.2&#x7248;&#x672C;&#x624D;&#x5F00;&#x59CB;&#x652F;&#x6301;&#x3002;</p>
<pre><code>&#x66F4;&#x591A;&#x8D44;&#x6599;&#x53C2;&#x8003;OpenGL&#x5B98;&#x7F51;&#xFF1A;
https://www.khronos.org/opengl/wiki/Category:Shaders
</code></pre><p>&#x672C;&#x4E66;&#x4E5F;&#x4EC5;&#x4ECB;&#x7ECD;Vertex Shader(&#x9876;&#x70B9;&#x7740;&#x8272;&#x5668;)&#x3001;Fragment Shader(&#x7247;&#x6BB5;&#x7740;&#x8272;&#x5668;)&#x3002;</p>
<p>&#x5728; <code>3.&#x7ED8;&#x5236;&#x7B80;&#x5355;&#x56FE;&#x5F62;</code> &#x8FD9;&#x4E00;&#x7AE0;&#x7684;&#x914D;&#x5957;&#x9879;&#x76EE;&#x91CC;&#xFF0C;<code>ShaderSource.h</code> &#x91CC;&#x9762;&#x5C31;&#x5B58;&#x653E;&#x7740;Vertex Shader &#x548C; Fragment Shader &#x7684;&#x6E90;&#x7801;&#x3002;</p>
<p>&#x5982;&#x4E0B;&#x56FE;&#xFF1A;</p>
<p><a href="../../imgs/shader/introduce_shader/shader_source_in_draw_polygon_samples.png" data-lightbox="33c37d2f-6834-4854-a1d3-2463bafd1a51" data-title=""><img src="../../imgs/shader/introduce_shader/shader_source_in_draw_polygon_samples.png" alt=""></a></p>
<p>&#x89C2;&#x5BDF;&#x8FD9;&#x6BB5;&#x4EE3;&#x7801;&#xFF0C;&#x53C8;&#x53D1;&#x73B0;&#x548C;C&#x8BED;&#x8A00;&#x7684;&#x76F8;&#x540C;&#x4E4B;&#x5904; -- &#x5165;&#x53E3;&#x90FD;&#x662F; <code>main</code> &#x51FD;&#x6570;&#x3002;</p>
<table>
<tbody><tr><td></td><td bgcolor="AliceBlue"><b>C&#x8BED;&#x8A00;</b></td><td bgcolor="AliceBlue"><b>Shader</b></td></tr>
<tr><td><b>&#x76EE;&#x6807;&#x786C;&#x4EF6;</b></td><td>CPU</td><td>GPU</td></tr>
<tr><td rowspan="6"><b>&#x5165;&#x53E3;</b></td><td>void main()</td><td>void main()</td></tr>
</tbody></table>

<p>&#x5F53;&#x524D;&#x5C0F;&#x8282;&#x5BF9;Shader&#x6709;&#x4E86;&#x4E00;&#x4E2A;&#x5927;&#x6982;&#x7684;&#x6620;&#x50CF;&#x5373;&#x53EF;&#xFF0C;&#x540E;&#x7EED;&#x7AE0;&#x8282;&#x518D;&#x8BE6;&#x7EC6;&#x4ECB;&#x7ECD;&#x3002; </p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; captainchen all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">File Modify: 
2021-04-02 11:26:42
</span></footer></body></html>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="4. 着色器.html" class="navigation navigation-prev " aria-label="Previous page: 4. 着色器">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="4.2 Unity Shader和OpenGL Shader.html" class="navigation navigation-next " aria-label="Next page: 4.2 Unity Shader和OpenGL Shader">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"4.1 着色器是什么","level":"2.5.1","depth":2,"next":{"title":"4.2 Unity Shader和OpenGL Shader","level":"2.5.2","depth":2,"path":"pages/4. 着色器/4.2 Unity Shader和OpenGL Shader.md","ref":"pages/4. 着色器/4.2 Unity Shader和OpenGL Shader.md","articles":[]},"previous":{"title":"4. 着色器","level":"2.5","depth":1,"path":"pages/4. 着色器/4. 着色器.md","ref":"pages/4. 着色器/4. 着色器.md","articles":[{"title":"4.1 着色器是什么","level":"2.5.1","depth":2,"path":"pages/4. 着色器/4.1 着色器是什么.md","ref":"pages/4. 着色器/4.1 着色器是什么.md","articles":[]},{"title":"4.2 Unity Shader和OpenGL Shader","level":"2.5.2","depth":2,"path":"pages/4. 着色器/4.2 Unity Shader和OpenGL Shader.md","ref":"pages/4. 着色器/4.2 Unity Shader和OpenGL Shader.md","articles":[]},{"title":"4.3 顶点着色器","level":"2.5.3","depth":2,"path":"pages/4. 着色器/4.3 顶点着色器.md","ref":"pages/4. 着色器/4.3 顶点着色器.md","articles":[]},{"title":"4.4 片段着色器","level":"2.5.4","depth":2,"path":"pages/4. 着色器/4.4 片段着色器.md","ref":"pages/4. 着色器/4.4 片段着色器.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["expandable-chapters","tbfed-pagefooter","splitter","lightbox","anchor-navigation-ex","search-pro","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy captainchen","modify_format":"YYYY-MM-DD HH:mm:ss"},"livereload":{},"splitter":{},"search-pro":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":false,"showLevel":false},"lightbox":{"jquery":true,"sameUuid":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"captainchen","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"游戏引擎浅入浅出","gitbook":"*"},"file":{"path":"pages/4. 着色器/4.1 着色器是什么.md","mtime":"2021-04-02T03:26:42.093Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-04-30T15:25:09.576Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

